package com.bbkb.quartz.vo;

public class ResultVo {

    /**
     * 成功标识，默认失败
     */
    private boolean success = false;

    /**
     * 状态码，0成功，非0失败
     */
    private String code = "999";

    /**
     * 错误提示
     */
    private String msg = "系统异常";

    /**
     * 分页总条数，layui适用
     */
    private long count = 0;

    /**
     * 返回数据，可以是数据表格，layui适用
     */
    private Object data;

    public ResultVo() {
    }

    public ResultVo(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static ResultVo success(long total, Object data) {
        ResultVo resultVo = new ResultVo();
        resultVo.setSuccess(true);
        resultVo.setCode("0");
        resultVo.setMsg("结果正常");
        resultVo.setCount(total);
        resultVo.setData(data);
        return resultVo;
    }

    public static ResultVo error(String msg) {
        ResultVo result = new ResultVo();
        result.setMsg(msg);
        return result;
    }

    public static ResultVo error(String code, String msg) {
        return new ResultVo(code, msg);
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
